package gameLogic;

import java.util.Iterator;
import java.util.TreeSet;

public class PlayerAI extends Player {
	private TreeSet<Strategy> strategyList;
	public PlayerAI(Board b, BoardState s, Observer ob) {
		super(b, s, ob);
		strategyList = new TreeSet<Strategy>();
	}

	public void addStrategy(Strategy s) {
		strategyList.add(s);
	}

	@Override
	public void makeMove() {
		Move move = null;
		Iterator<Strategy> i = strategyList.descendingIterator(); 
		while(i.hasNext()) {
			Strategy s = i.next();
			move = s.getMove();
			if(move != null) {
				System.out.println("*** "+s.getClass()+" "+move+" ***");
				break;
			}
		}
		if(move != null)
			b.makeMove(move);
		else
			manualOverride();
	}	
}
